﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewOutGoingTransmittal.aspx.cs"
    Inherits="POI.eTransmittal.WebApp.NewOutGoingTransmittal" %>

<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Xpo.v11.2.Web, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Xpo" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Src="Usercontrols/StatusControl.ascx" TagName="StatusControl" TagPrefix="uc1" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function showInfo(message) {
            setOkExtention(exit);
            ShowStatusMessage(message);
        }
        function showError(message) {

            ShowErrorMessage(message);
    
        }
        function exit() {
            window.close();
        }
        function onFileChanged(s, e) {
            if (s.GetText() != 'Cancel') {
                s.SetText('Cancel');
                toggleUpload('change');
            }
            else {
                //s.SetText('Change File');
                clbCancel.PerformCallback();
            }
        }
        function toggleUpload(s) {
            var text = s;
            switch (text) {
                case 'change':
                    //var dv = document.getElementById('divReadDoc');
                    //dv.style.display = 'none';
                    upcDoc.SetClientVisible(true);
                    break;
                case 'view':
                    //var dv = document.getElementById('divReadDoc');
                    //dv.style.display = 'block';
                    upcDoc.SetClientVisible(false);


                    break;


            }
        }
        function OnUploadCanceled(e) {
            btnChange.SetText(e.result);
            toggleUpload('view');
        }
    </script>
</head>
<body>
    <form id="form1" style="width: 800px" runat="server">
    <div>
        <table width="100%">
            <tr>
                <td valign="top" style="width: 350px; height: 170px">
                    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" View="GroupBox" HeaderText="Fax Properties">
                        <PanelCollection>
                            <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
                                <table width="100%" style="height: 170px">
                                    <tr>
                                        <td>
                                            Subject
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxTextBox ID="txtSubject" runat="server" Width="300px" ClientInstanceName="txtSubject">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Author
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxComboBox ID="cboAuthor" runat="server" CallbackPageSize="8" ClientInstanceName="cboAuthor"
                                                DataSourceID="xpodsUser" DropDownStyle="DropDown" EnableCallbackMode="True" EnableIncrementalFiltering="True"
                                                IncrementalFilteringMode="StartsWith" TextField="Name" ValueField="UserID">
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            To
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxComboBox ID="cboTo" runat="server" ClientInstanceName="cboTo" DropDownStyle="DropDown"
                                                DataSourceID="xpdsContact" TextField="Name" ValueField="ID" IncrementalFilteringMode="Contains">
                                                <ClientSideEvents SelectedIndexChanged="function(s, e) {

	cboFax.PerformCallback(s.GetValue()+';'+cboFax.GetText());
}" />
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Fax No
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxComboBox ID="cboFax" runat="server" ClientInstanceName="cboFax" DropDownStyle="DropDown"
                                                EnableIncrementalFiltering="True" IncrementalFilteringMode="StartsWith" OnCallback="cboFax_Callback"
                                                TextField="Value" ValueField="Value" DataSourceID="xpodsFax">
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Attn
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxTextBox ID="txtAttn" runat="server" Width="100%" ClientInstanceName="txtAttn">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Remarks
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxTextBox ID="txtRemarks" runat="server" Width="300px" ClientInstanceName="txtRemarks">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                </table>
                            </dx:PanelContent>
                        </PanelCollection>
                    </dx:ASPxRoundPanel>
                </td>
                <td valign="top" style="height: 156px" width="500px">
                    <dx:ASPxRoundPanel ID="ASPxRoundPanel2" runat="server" View="GroupBox" Width="100%"
                        HeaderText="Transmittal">
                        <PanelCollection>
                            <dx:PanelContent ID="PanelContent2" runat="server" SupportsDisabledAttribute="True">
                                <table width="100%" style="height: 170px">
                                    <tr>
                                        <td style="width: 90px">
                                            Log No.&nbsp;
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxLabel ID="lblLog" runat="server" Text="(auto generated)" ClientInstanceName="lblLog">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Document Type
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxComboBox ID="cboDocType" runat="server" DropDownStyle="DropDown" DataSourceID="xpodsDocType"
                                                TextField="TypeName" ValueField="Code">
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Created By
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxLabel ID="lblCreatedBy" runat="server">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Created Date
                                        </td>
                                        <td bgcolor="#CCCCCC">
                                            <dx:ASPxLabel ID="lblCreatedDate" runat="server" Text="ASPxLabel">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            File
                                        </td>
                                        <td height="30px" bgcolor="#CCCCCC">
                                            <dx:ASPxButton ID="btnChange" runat="server" 
                                                AutoPostBack="False" ClientInstanceName="btnChange" Width="280px">
                                                <ClientSideEvents Click="function(s, e) {
	onFileChanged(s,e);
}" />
                                            </dx:ASPxButton>
                                            <dx:ASPxUploadControl ID="upcDoc" runat="server" Width="280px" 
                                                ClientVisible="False" ClientInstanceName="upcDoc">
                                                <ValidationSettings MultiSelectionErrorText="Attention! 

The following {0} files are invalid because they exceed the allowed file size ({1}) or their extensions are not allowed. These files have been removed from selection, so they will not be uploaded. 

{2}">
                                                </ValidationSettings>
                                            </dx:ASPxUploadControl>
                                        </td>
                                    </tr>
                                </table>
                            </dx:PanelContent>
                        </PanelCollection>
                    </dx:ASPxRoundPanel>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td align="right">
                    <table>
                        <tr>
                            <td>
                                <dx:ASPxButton ID="btnSubmit" runat="server" Text="Submit" AutoPostBack="False" OnClick="btnSubmit_Click">
                                    <ClientSideEvents Click="function(s, e) {
	ShowLoading(&quot;Please wait...&quot;);
}" />
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnSave" runat="server" Text="Save" AutoPostBack="False" OnClick="btnSave_Click">
                                    <ClientSideEvents Click="function(s, e) {
ShowLoading(&quot;Please wait...&quot;);
	//clbSave.PerformCallback();
}" />
                                </dx:ASPxButton>
                            </td>
                           
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <dx:XpoDataSource ID="xpdsContact" runat="server" TypeName="POI.eTransmittal.Enitity.Contact">
    </dx:XpoDataSource>
    <dx:XpoDataSource ID="xpodsDocType" runat="server" TypeName="POI.eTransmittal.Enitity.DocumentType">
    </dx:XpoDataSource>
    <dx:XpoDataSource ID="xpodsUser" runat="server" TypeName="POI.eTransmittal.Enitity.TransmittalUser">
    </dx:XpoDataSource>
    <dx:ASPxCallback ID="clbCancel" runat="server" ClientInstanceName="clbCancel" 
        oncallback="clbCancel_Callback">
        <ClientSideEvents CallbackComplete="function(s, e) {
	OnUploadCanceled(e);
}" />
    </dx:ASPxCallback>
    <dx:ASPxPopupControl ID="popInfo" runat="server" HeaderText="Transmittal Information"
        Width="300px" ClientInstanceName="popInfo" Modal="True" 
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
        <ClientSideEvents Shown="function(s, e) {
	txtRefNo.SetSelection(0,txtRefNo.GetText().length);
}" />
        <ContentCollection>
            <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <table width="100%">
                    <tr>
                        <td colspan="2">
                            <dx:ASPxLabel ID="lblInfomessage" runat="server">
                            </dx:ASPxLabel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        Log No.
                        </td>
                        <td>
                            <dx:ASPxLabel ID="lblLogNo" runat="server" Text="lblLOg">
                            </dx:ASPxLabel>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                        Ref No.
                        </td>
                        <td>
                            <dx:ASPxTextBox ID="txtRefNo" runat="server" Width="170px" ReadOnly="True" 
                                ClientInstanceName="txtRefNo">
                            </dx:ASPxTextBox>
                            <dx:ASPxLabel ID="ASPxLabel3" runat="server" Font-Italic="True" 
                                Font-Size="X-Small" Text="Press Ctrl+C to copy">
                            </dx:ASPxLabel>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <dx:ASPxButton ID="btnOk" runat="server" Text="OK" AutoPostBack="False">
                                <ClientSideEvents Click="function(s, e) {

                                if(lblUrl.GetValue() != &quot;&quot; &amp;&amp; lblUrl.GetValue()!= null){
		window.location = lblUrl.GetValue();		
	}
	popInfo.Hide();
window.close();
      
	
}" />
                            </dx:ASPxButton>
                            <dx:ASPxLabel ID="lblUrl" runat="server" ClientInstanceName="lblUrl" 
                                ClientVisible="False">
                            </dx:ASPxLabel>
                        </td>
                    </tr>
                </table>
            </dx:PopupControlContentControl>
        </ContentCollection>
    </dx:ASPxPopupControl>
    <dx:XpoDataSource ID="xpodsFax" runat="server" Criteria="[Contact.ID] = ?" TypeName="POI.eTransmittal.Enitity.ContactInfo">
        <CriteriaParameters>
            <asp:SessionParameter DefaultValue="-1" Name="Contact.ID" SessionField="newOutGoingTransmittal_Contact" />
        </CriteriaParameters>
    </dx:XpoDataSource>
    <uc1:StatusControl ID="StatusControl1" runat="server" />
    <dx:ASPxPopupControl ID="popLoading" runat="server" ClientInstanceName="popLoading"
        Height="109px" ShowHeader="False" Width="410px">
        <ContentCollection>
            <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <table style="height: 100%" width="100%">
                    <tr>
                        <td align="center" valign="middle" style="height: 100%">
                            <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="Please Wait...">
                            </dx:ASPxLabel>
                        </td>
                    </tr>
                </table>
            </dx:PopupControlContentControl>
        </ContentCollection>
    </dx:ASPxPopupControl>
    </form>
</body>
</html>
